package de.dhbw.horb.inf2013.vierFarbenProblem.view.java2D;

import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;
import java.util.Arrays;

/**
 * The Class Polygon.
 */
public class Polygon {

	/** The xs. */
	private int[] xs;

	/** The ys. */
	private int[] ys;

	/** The id. */
	private int id;

	/** The color. */
	private Color color;

	/**
	 * Instantiates a new polygon.
	 * 
	 * @param id
	 *            the id
	 */
	public Polygon(int id) {
		this.id = id;
	}

	/**
	 * Adds the xs.
	 * 
	 * @param xs
	 *            the xs
	 */
	public void addXs(int[] xs) {
		this.xs = xs;
	}

	/**
	 * Adds the ys.
	 * 
	 * @param ys
	 *            the ys
	 */
	public void addYs(int[] ys) {
		this.ys = ys;
	}

	/**
	 * Sets the color.
	 * 
	 * @param c
	 *            the new color
	 */
	public void setColor(Color c) {
		color = c;
	}

	/**
	 * Paint.
	 * 
	 * @param g
	 *            the g
	 */
	public void paint(Graphics g) {
		if (color != null) {
			g.setColor(color);
		} else {
			g.setColor(Color.gray);
		}

		g.fillPolygon(xs, ys, xs.length);
		g.setColor(Color.WHITE);
		g.drawPolygon(xs, ys, xs.length);

	}

	/**
	 * Gets the id.
	 * 
	 * @return the id
	 */
	public int getId() {
		return id;
	}
}
